this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.Ui=this.BX.Landing.Ui||{};this.BX.Landing.Ui.Panel=this.BX.Landing.Ui.Panel||{};this.BX.Landing.Ui.Panel.Formsettingspanel=this.BX.Landing.Ui.Panel.Formsettingspanel||{};(function(e,t,n,i,r,a,s,o,l,c,g,u,d){"use strict";var p=function(e){babelHelpers.inherits(t,e);function t(e){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));u.Dom.removeClass(n.input,"landing-ui-field-input");n.getTagSelector().renderTo(n.input);return n}babelHelpers.createClass(t,[{key:"getTagSelector",value:function e(){var t=this;return this.cache.remember("tagSelector",(function(){var e=g.PageObject.getRootWindow();return new e.BX.UI.EntitySelector.TagSelector({id:"user-selector",dialogOptions:{id:"user-selector",entities:[{id:"user",options:{activeUsers:true}}],preselectedItems:t.options.value,events:{"Item:onSelect":function e(){t.emit("onChange",{skipPrepare:true})},"Item:onDeselect":function e(){t.emit("onChange",{skipPrepare:true})}}}})}))}},{key:"getValue",value:function e(){return this.getTagSelector().getDialog().getSelectedItems().map((function(e){return e.id}))}}]);return t}(l.BaseField);var m;function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){babelHelpers.defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var b=function(e){babelHelpers.inherits(t,e);function t(e){var a;babelHelpers.classCallCheck(this,t);a=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));a.setEventNamespace("BX.Landing.UI.Panel.FormSettingsPanel.SpamProtection");var s=new n.HeaderCard({title:i.Loc.getMessage("LANDING_FORM_OTHER_TITLE")});var o=new r.FormSettingsForm({id:"other",description:null,fields:[a.getNameField(),a.getUserSelectorField(),a.getCheckWorkTimeField(),a.getLanguageField(),a.getUseSignField()]});a.addItem(s);a.addItem(o);var l=new d.BaseCard;u.Dom.style(l.getLayout(),{padding:0,margin:0});var c=a.options.formOptions.id;u.Dom.append(u.Tag.render(m||(m=babelHelpers.taggedTemplateLiteral(["<div>",": ","</div>"])),i.Loc.getMessage("LANDING_CRM_FORM_ID"),c),l.getBody());a.addItem(l);return a}babelHelpers.createClass(t,[{key:"canRemoveCopyrights",value:function e(){return this.options.dictionary.sign.canRemove}},{key:"getNameField",value:function e(){var t=this;return this.cache.remember("nameField",(function(){return new a.TextField({title:i.Loc.getMessage("LANDING_FORM_OTHER_TITLE_NAME_TITLE"),selector:"name",textOnly:true,content:t.options.formOptions.name})}))}},{key:"getUseSignField",value:function e(){var t=this;return this.cache.remember("useSignField",(function(){return new BX.Landing.UI.Field.Checkbox({selector:"useSign",value:t.options.formOptions.data.useSign?["useSign"]:[],items:[{value:"useSign",html:"".concat(i.Loc.getMessage("LANDING_HEADER_AND_BUTTONS_SHOW_SIGN")).concat(t.createCopyRight()),name:""}],compact:true})}))}},{key:"getUserSelectorField",value:function e(){var t=this;return this.cache.remember("userSelectorField",(function(){return new p({selector:"users",title:i.Loc.getMessage("LANDING_CRM_FORM_USER"),value:t.options.formOptions.responsible.users.reduce((function(e,t){if(u.Type.isStringFilled(t)||u.Type.isNumber(t)){e.push(["user",t])}return e}),[])})}))}},{key:"getCheckWorkTimeField",value:function e(){var t=this;return this.cache.remember("checkWorkTimeField",(function(){return new BX.Landing.UI.Field.Checkbox({selector:"checkWorkTime",compact:true,value:[t.options.formOptions.responsible.checkWorkTime?"Y":"N"],items:[{name:i.Loc.getMessage("LANDING_FORM_OTHER_CHECK_WORK_TIME"),value:"Y"}]})}))}},{key:"getLanguageField",value:function e(){var t=this;return this.cache.remember("language",(function(){return new BX.Landing.UI.Field.Dropdown({selector:"language",title:i.Loc.getMessage("LANDING_CRM_FORM_LANGUAGE"),items:t.options.dictionary.languages.map((function(e){return{name:e.name,value:e.id}})),content:t.options.formOptions.data.language})}))}},{key:"createCopyRight",value:function e(){return'\n\t\t\t<span class="landing-ui-signin">\n\t\t\t\t<span class="landing-ui-sign">'.concat(i.Loc.getMessage("LANDING_HEADER_AND_BUTTONS_BUTTONS_SIGN"),'</span>\n\t\t\t\t<span class="landing-ui-sign-in">').concat(i.Loc.getMessage("LANDING_HEADER_AND_BUTTONS_BUTTONS_SIGN_BY"),'</span>\n\t\t\t\t<span class="landing-ui-sign-24">24</span>\n\t\t\t</span>\n\t\t')}},{key:"valueReducer",value:function e(t){return{name:t.name,data:{language:this.getLanguageField().getValue(),useSign:t.useSign.includes("useSign")},responsible:{users:t.users,checkWorkTime:t.checkWorkTime[0]==="Y"}}}},{key:"onChange",value:function e(t){if(!this.canRemoveCopyrights()){var n=this.getUseSignField();if(!n.getValue().includes("useSign")){n.setValue(["useSign"]);if(u.Type.isStringFilled(this.options.dictionary.restriction.helper)){var i=u.Reflection.getClass("BX.evalGlobal");if(u.Type.isFunction(i)){i(this.options.dictionary.restriction.helper)}}}}this.emit("onChange",f(f({},t.getData()),{},{skipPrepare:true}))}}]);return t}(s.ContentWrapper);e.default=b})(this.BX.Landing.Ui.Panel.Formsettingspanel.Content=this.BX.Landing.Ui.Panel.Formsettingspanel.Content||{},BX,BX.Landing.UI.Card,BX.Landing,BX.Landing.UI.Form,BX.Landing.UI.Field,BX.Landing.UI.Panel,BX.Event,BX.Landing.UI.Field,BX.UI.EntitySelector,BX.Landing,BX,BX.Landing.UI.Card);
//# sourceMappingURL=other.bundle.map.js